package com.danskin.wechat.service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.danskin.wechat.dto.CustInfoDto;
import com.danskin.wechat.entity.CrmBrandInfo;
import com.danskin.wechat.entity.CustCouponDetail;
import com.danskin.wechat.entity.CustInfo;
import com.danskin.wechat.entity.CustInfoEx;
import com.danskin.wechat.entity.WxFansCard;
import com.danskin.wechat.entity.WxMediaPlatform;
import com.danskin.wechat.model.AccessResponse;
import com.danskin.wechat.util.Page;
import com.danskin.wechat.vo.CustInfoVo;

public interface CustInfoService {
	
	/**
	 * 用户注册
	 * @param map
	 * @param platForm
	 * @param memberId
	 * @param memberLevel
	 * @return
	 * @author makunsmac
	 */
	public AccessResponse<String> saveMemberRegister(Map<String, Object> map, WxMediaPlatform platForm, String memberId, String memberLevel);
	
	/**
	 * 变更积分
	 * @param map
	 * @param custInfoDto
	 * @param brandInfo
	 * @return
	 * @author makunsmac
	 */
	public AccessResponse<String> pointChange(Map<String, Object> map, CrmBrandInfo brandInfo);
	
	/**
	 * 根据手机号判断会员身份
	 * @param map
	 * @param appId
	 * @return
	 * @author makunsmac
	 */
	public AccessResponse<String> judgeUserStatusByTel(String mobile, Integer mpId);
	
	/**
	 * 根据用户openId判断会员身份
	 * @param map
	 * @param appId
	 * @return
	 * @author makunsmac
	 */
	public AccessResponse<String> judgeUserStatusByOpenId(String openId, Integer mpId);
	
	/**
	 * 根据手机号发送现金券
	 * @param couponNum
	 * @param mobile
	 * @param mpId
	 * @return
	 * @author makunsmac
	 */
	public Object sendCouponByMobile(BigDecimal couponNum, String mobile, Integer mpId, String brandId, String changeReason);
	
	
	public Object sendCouponToCust(String templateId, String mobile,String openId, Integer mpId, String brandId, String changeReason);
	
	/**
	 * 根据openId发送现金券
	 * @param couponNum
	 * @param openId
	 * @param mpId
	 * @return
	 * @author makunsmac
	 */
	public Object sendCouponByOpenId(BigDecimal couponNum, String openId, Integer mpId, String brandId, String changeReason);
	
	/**
	 * 根据用户手机号和mpId查询用户custExId
	 * @param mobile
	 * @param mpId
	 * @return
	 * @author makunsmac
	 */
	List<CustInfoDto> selectCustExIdByMobileAndOpenIdAndMpId(String mobile, Integer mpId);

	/**
	 * 根据主键获取用户信息
	 * 
	 * @param id
	 * @return
	 * @author makunsmac
	 */
	public CustInfo queryCustInfoById(Integer id);
	
	/**
	 * 查询符合条件的用户信息
	 * @param param
	 * @return
	 * @author makunsmac
	 */
	List<CustInfo> selectCustInfoByExample(CustInfo param);
	
	/**
	 * 查询符合条件的用户数
	 * @param param
	 * @return
	 * @author makunsmac
	 */
	Integer selectCountByExample(CustInfo param);
	
	/**
	 * 新建用户返回主键ID
	 * @param record
	 * @return
	 * @author makunsmac
	 */
	Integer insertSelective(CustInfo param);

	public List<CustInfo> getCustInfoList(Page page);

	public List<CustCouponDetail> getCustCouponDetailList(CustCouponDetail custCouponDetail);

	public CustInfo saveCustInfoSelective(CustInfo info, String OpenId);
	public CustInfo updateCustInfoSelective(CustInfo info, String OpenId);
	
	

	Map<String, Object> queryByOpenId(String wxOpenId);

	/**
	 * 根据用户微信OpenId查询用户信息
	 * 
	 * @param wxOpenId
	 * @return
	 * @author makunsmac
	 */
	CustInfoVo queryCustInfoDtoByOpenId(String wxOpenId); 
	/**
	 * 激活微信会员卡，并保存会员信息
	 * @param accessToken
	 * @param mpId
	 * @param mobile
	 * @param wxOpenId
	 * @param cardId
	 * @param userCardCode
	 */
	void activateMemberInfo(String accessToken, int mpId,String appId, String mobile, String wxOpenId, String cardId,
			String userCardCode);
	
	 
	int saveCustInfo(CustInfo custInfo, CustInfoEx custInfoEx);
	
	int createMemberInfo(CrmBrandInfo brandInfo, String mobile);

	int updateCustInfo(WxMediaPlatform mp,CustInfo custInfo, CustInfoEx custInfoEx);
	
	/**
	 * 获取可用积分、会员等级、可用券数量
	 * @param openId
	 * @return
	 * @author likui.liu
	 */
	void userViewCard(String accessToken, String openId, WxFansCard fansCard);

	public List<CustInfo> getCustInfoListExport(String name, String mobile, String subscribe, String startTime,
			String endTime,String mpId);
	
	public Map<String, Object> queryCustVipLevel(String openId);
	
	void activateMemberInfo2(String accessToken, int mpId, String appId, String mobile, String wxOpenId,
			String cardId, String userCardCode);
	
	int updateMember(WxMediaPlatform mp, String openId, String mobile);
}
